<!DOCTYPE html>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		省份：<select name="" id="selet1" onchange="prionchage()">
			<option value="-1">请选择省份</option>
		</select>
		城市：<select name="" id="selet2" onchange="cityarrchange()">
			<option value="-1">请选择城市</option>
		</select>
		区县：<select name="" id="selet3" onchange="Countyarrchange()">
			<option value="-1">请选择区县</option>
		</select>
		<br />
		你选择了：<label for="" id="ab1"></label>
	</body>
	<script>
		var priarr=['北京市','福建省','广东省','浙江省','云南省'];
		var cityarr=[
			['北京市'],
			['福州市','泉州市'],
			['深圳市','珠海市'],
			['杭州市','宁波市'],
			['昆明市','保山市']
		];
		var Countyarr=[
			[['朝阳区','海淀区','东城区']],
			[['鼓楼区','台江区','仓山区'],['鲤城区','丰泽区','安溪县']],
			[['龙华区','光明区'],['香洲区','斗门区']],
			[['西湖区','桐庐县'],['镇海区','宁海县']],
			[['五华区','盘龙区'],['隆阳区','昌宁县']]
		];
		onload=function(){
			for(var i=0;i<priarr.length;i++){
				document.getElementById('selet1').innerHTML+=`<option value="`+i+`">`+priarr[i]+`</option>`;
			};
		};
		var id=document.getElementById('selet1');
		var idd=document.getElementById('selet2');
		var iddd=document.getElementById('selet3');
		function prionchage(){
			document.getElementById('selet2').innerHTML=`<option value="-1">请选择城市</option>`;
			for(var i=0;i<cityarr[id.value].length;i++){
				document.getElementById('selet2').innerHTML+=`<option value="`+i+`">`+cityarr[id.value][i]+`</option>`;
			}
		}
		
		function cityarrchange(){
			document.getElementById('selet3').innerHTML=`<option value="-1">请选择区县</option>`;
			for(var i=0;i<Countyarr[id.value][idd.value].length;i++){
				document.getElementById('selet3').innerHTML+=`<option value="`+i+`">`+Countyarr[id.value][idd.value][i]+`</option>`;
			}
		}
		function Countyarrchange(){
			var id=document.getElementById('selet1');
			var idd=document.getElementById('selet2');
			var iddd=document.getElementById('selet3');
			document.getElementById('ab1').innerText=id.options[id.selectedIndex].text+
			'-'+idd.options[idd.selectedIndex].text+'-'+iddd.options[iddd.selectedIndex].text;
		}
	</script>
</html>
